$(document).ready(function(){					
	var canvas = document.getElementById('canvas');//画布
	var stage = new JTopo.Stage(canvas);//舞台
	//显示工具栏 showJTopoToobar(stage);
	
	var scene = new JTopo.Scene(stage);//场景
	scene.background = './img/bg.jpg';//场景背景图片
	stage.add(scene);
	
	var scene2 = new JTopo.Scene(stage);//场景
	scene2.visible = false;
	stage.add(scene2);
	
	for(var i = 0 ; i < 100 ; i++){
		var node = new JTopo.Node()
        node.setLocation(Math.random() * stage.width, Math.random()*stage.height);
        
        var color = Math.floor(Math.random() * 255)
                + ',' + Math.floor(Math.random() * 255)
                + ',' + Math.floor(Math.random() * 255);
        node.fillStyle = color;
        
        if(i % 2 == 0){
            scene.add(node);
        }else{
            scene2.add(node);
        }            
	}
	
	function changeScene(){
        if(scene.visible){
            scene2.visible = true;
            scene.visible = false;
        }else{
            scene2.visible = false;
            scene.visible = true;
        }                
    }
    
    stage.addEventListener('click', function(event){
        changeScene();
    }); 
    
});
	